package com.demo.salary.payrollimplementation;


import com.demo.salary.PayCheck;
import com.demo.salary.payrolldomain.PaymentClassification;

import java.util.ArrayList;
import java.time.LocalDate;
import java.util.List;

public class CommissionedClassification extends PaymentClassification {

    double commissionRate;
    double salary;

    List<SalesReceipt> salesReceiptList;

    public CommissionedClassification(double commissionRate, double salary) {
        this.commissionRate = commissionRate;
        this.salary = salary;
        salesReceiptList = new ArrayList<>();
    }

    public double getCommissionRate() {
        return commissionRate;
    }

    public double getSalary() {
        return salary;
    }

    public void addSalesReceipt(SalesReceipt salesReceipt) {
        salesReceiptList.add(salesReceipt);
    }

    public SalesReceipt getSalesReceipt(LocalDate date) {
        for (SalesReceipt salesReceipt : salesReceiptList) {
            if (date.equals(salesReceipt.getDate())) {
                return salesReceipt;
            }
        }
        return null;
    }


    @Override
    public double calculatePay(PayCheck pc) {
        return 0;
    }
}
